package 滑动窗口;

import java.util.ArrayList;

public class 滑动窗口的最大值 {

    public int[] maxSlidingWindow(int[] nums, int k) {
        if (nums.length==0)
            return new int[]{};
        int[] ints = new int[nums.length - k + 1];
        for (int start = 0,end=k-1; end<nums.length ;start++,end++) {
            int cur=Integer.MIN_VALUE;
            for (int i = start; i <=end ; i++) {
                cur=Math.max(cur,nums[i]);
            }
            ints[start]=cur;
        }
        return ints;
    }
}
